package com.qf.dao.impl;

import com.qf.dao.UserDao;
import com.qf.entity.User;
import com.qf.utils.DataBase;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

@Service
public class UserDaoImpl implements UserDao {

    @Override
    public User selectByname(String username) {
        // 去保存了用户信息的(数据库)集合中查询
        return DataBase.userDB.get(username);
    }

    @Override
    public boolean addUser(User user) {
        DataBase.userDB.put(user.getUsername(),user);
        return true;
    }

    @Override
    public boolean addUser(String username, String password) {
        DataBase.userDB.put(username,new User(username,password));
        return true;
    }

    @Override
    public boolean updateUser(User user) {
        return false;
    }

    @Override
    public boolean deleteUser(String username) {
        return false;
    }
}
